// ActionScript file
import mx.core.Application;
//每页记录条数
[Bindable]
public var numbPerPageXml:XML=<page><item data="10" value="10" /><item data="20" value="20"/><item data="30" value="30"/><item data="40" value="40"/><item data="50" value="50"/><item data="60" value="60"/><item data="100" value="100"/></page>;
[Bindable]
public var xxlxXml:XML=<xxlx><item data="一般" value="0" /></xxlx>;
[Bindable]
public var mjXml:XML=<mj><item data="秘密" value="0" /><item data="机密" value="1"/><item data="绝密" value="2"/></mj>;
[Bindable]
public var unitXml:XML;
public var appWsdl:String;
public var unitInfoXml:XML=<unit>
								<name>政法委</name>
								<wsdl>http://localhost:8088</wsdl>
							</unit>;//本单位的信息
public var userInfoXml:XML = <user>
								<username>张三丰</username>
								<guid>abcdefghijklmn</guid>
							  </user>;
import mx.managers.PopUpManager;
import logic.component.bs.WriteBsxx;
import mx.utils.URLUtil;
import component.RichDataGrid;
import logic.component.bs.EditBsxx;
import logic.component.bs.DealBsxx;
import logic.component.bs.BsxxDetailWin;
import logic.component.bs.BsxxMenu;
import logic.component.society.SocietyMenu;
import flash.display.DisplayObject;
import logic.component.society.dhbl.RecordPhone;
import logic.component.purview.UserList;
import logic.component.purview.PurviewMenu;
import logic.component.purview.AddItemPanel;
import logic.component.purview.EditUserInfoPanel;
import logic.component.infomation.InfomationMenu;
import logic.component.infomation.FckEditorForFlex;
import logic.component.purview.RoleList;
import logic.component.purview.EditRoleInfoPanel;
import logic.component.purview.EditResourceInfoPanel;
import logic.component.purview.ResourceList;
import logic.component.infomation.ManageInfomation;
import logic.component.infomation.LmEdit;
import logic.component.infomation.AddInfomationWindow;
import logic.component.file.FileMenu;
import logic.component.file.ManageFile;
import logic.component.file.FileLmEdit;
import logic.component.affiche.AfficheMenu;
import logic.component.affiche.AddAfficheWin;
import logic.component.purview.TxlList;
import logic.component.purview.UserCard;
import logic.component.affiche.AffichePopUpWin;
import logic.component.affiche.ViewAfficheWin;
import logic.component.bs.BsxxSc;
[Bindable]
public var projectPath:String = "";
[Embed(source="swf/1.swf")]
private var bgSWF:Class;
public var params:Object;
public var tables:Object = new Object();
public var leftMenu:Object = new Object();
public var components:Object = new Object();
public var appRoot:DisplayObject;
public function creationComplete():void
{
	btnLogon.setStyle("textRollOverColor","#ffffff");
	appRoot = this;
	/* var urlStr:String = mx.core.Application.application.url;
	var serverName:String = URLUtil.getServerNameWithPort(urlStr);
	var infomationXml:XML = new XML(ExternalInterface.call("genInfomation"));
	var projectName:String = infomationXml.projectName;
	var projectPath:String = serverName.concat("/"+projectName); */
	var writeBsxx:WriteBsxx = new WriteBsxx();//写报送信息
	var editBsxx:EditBsxx = new EditBsxx();//编辑报送信息
	var bsxxSc:BsxxSc = new BsxxSc();//报送信息送呈卡
	var dealBsxx:DealBsxx = new DealBsxx();//处理报送信息
	var recordPhone:RecordPhone = new RecordPhone();//记录电话
	components["bsxxSc"] = bsxxSc;
	/*用户管理实体定义*/
	var addItemPanel:AddItemPanel = new AddItemPanel();
	var userList:UserList = new UserList();//用户列表
	var editUserInfoPanel:EditUserInfoPanel = new EditUserInfoPanel();
	var userCard:UserCard = new UserCard();//用户详细信息卡
	var roleList:RoleList = new RoleList();//角色列表
	var editRoleInfoPanel:EditRoleInfoPanel = new EditRoleInfoPanel();	
	var editResourceInfoPanel:EditResourceInfoPanel = new EditResourceInfoPanel();	
	var resourceList:ResourceList = new ResourceList();
	var perviewMenu:PurviewMenu = new PurviewMenu();
	var txl:TxlList = new TxlList();
	leftMenu["purviewMenu"] = new PurviewMenu();
	components["userList"] = userList;
	components["userCard"] = userCard;
	components["txl"] = txl;
	components["roleList"] = roleList;
	components["resourceList"] = resourceList;
	components["editUserInfoPanel"] = editUserInfoPanel;
	components["editRoleInfoPanel"] = editRoleInfoPanel;
	components["editResourceInfoPanel"] = editResourceInfoPanel;//资源更改
	/*用户管理实体定义结束*/
	
	/*信息管理实体定义*/
	var informationMenu:InfomationMenu = new InfomationMenu();
	var addInfomationWindow:AddInfomationWindow = new AddInfomationWindow();
	var richEditor:FckEditorForFlex = new FckEditorForFlex();
	var manageInfomation:ManageInfomation = new ManageInfomation();
	var infoLmEdit:LmEdit = new LmEdit();
	components["manageInfomation"] = manageInfomation;
	components["infoLmEdit"] = infoLmEdit;
	components["richEditor"] = richEditor;
	components["addInfomationWindow"] = addInfomationWindow;
	/*信息管理实体定义结束*/
	/*文件管理实体定义*/
	var fileMenu:FileMenu = new FileMenu();
	var manageFile:ManageFile = new ManageFile();
	var fileLmEdit:FileLmEdit = new FileLmEdit();
	components["manageFile"] = manageFile;
	components["fileLmEdit"] = fileLmEdit;
	/*文件实体定义结束*/
	/*公告管理*/
	var addAfficheWin:AddAfficheWin = new AddAfficheWin();
	var afficheMenu:AfficheMenu = new AfficheMenu();
	var affichePopUpWin:AffichePopUpWin = new AffichePopUpWin();
	var viewAfficheWin:ViewAfficheWin = new ViewAfficheWin();
	leftMenu["afficheMenu"]=afficheMenu;//公告管理菜单
	components["addAfficheWin"] = addAfficheWin;//添加电子公告
	components["affichePopUpWin"] = affichePopUpWin;//弹出式电子公告
	components["viewAfficheWin"] = viewAfficheWin;//弹出式电子公告详细内容
	
	
	/*公告管理结束*/
	//左侧菜单集体生成
	var bsxxMenu:BsxxMenu = new BsxxMenu();//报送信息菜单
	var societyMenu:SocietyMenu = new SocietyMenu();//社会工作部办公菜单
	leftMenu["bsxxMenu"]=bsxxMenu;//报送信息菜单
	leftMenu["societyMenu"]=societyMenu;//社会工作部办公菜单
	leftMenu["informationMenu"]=informationMenu;//信息管理菜单
	leftMenu["fileMenu"]=fileMenu;//文件管理菜单
	//菜单生成成功
	var bsxxDetailWin:BsxxDetailWin = new BsxxDetailWin();//报送信息细节窗口
	components["bsxx"] = writeBsxx;
	components["dealBsxx"] = dealBsxx;
	components["editBsxx"] = editBsxx;
	components["bsxxDetailWin"] = bsxxDetailWin;
	components["recordPhone"] = recordPhone;
	components["addItemPanel"] = addItemPanel;
	
	
	projectPath = "http://localhost:8088/xyInfo";
	params = new Object();
	params["projectPath"]=projectPath;
	
}
public function showMenu(menuName:String):void
{
	menuApplicationControlBar.removeAllChildren();
	workCanvas.removeAllChildren();
	menuApplicationControlBar.addChild(leftMenu[menuName]);
	leftMenu[menuName].x = 0;
	leftMenu[menuName].y = 0;
	if(menuName=="perviewMenu")
	{
		
	}
}
public function showAffichePopUpWin():void
{
	mx.core.Application.application.components["affichePopUpWin"].x = mx.core.Application.application.width - mx.core.Application.application.components["affichePopUpWin"].width;
	mx.core.Application.application.components["affichePopUpWin"].y = 40;
	PopUpManager.addPopUp(mx.core.Application.application.components["affichePopUpWin"],this,false);
	afficheImg.visible = false;
}

public function showGrid(gridName:String):void
{
	workCanvas.removeAllChildren();
	if(tables[gridName]==null)
	{
		var richDataGrid:RichDataGrid = new RichDataGrid();
		params["tableName"]=gridName;
		workCanvas.addChild(richDataGrid);
		richDataGrid.width = workCanvas.width;
		richDataGrid.height = workCanvas.height;
		richDataGrid.init(params);
		tables[gridName] = richDataGrid;
	}
	else
	{
		workCanvas.addChild(tables[gridName]);
	}
}
public function showWorkComp(compName:String):void
{
	workCanvas.removeAllChildren();
	workCanvas.addChild(components[compName]);
	/* components[compName].width = workCanvas.width;
	components[compName].height = workCanvas.height; */

}